package org.jlamp.boot.client;

import io.netty.buffer.ByteBuf;
import okhttp3.*;

import java.util.List;
import java.util.Map;

/**
 * 客户端
 *
 * @author zhangcs
 * @since 1.0
 */
public class JlampClient {

    /**
     * Http客户端
     */
    private static OkHttpClient client = new OkHttpClient();

    public static String get(String url) {
        Request request = new Request.Builder()
                .url(url)
                .build();

        Call call = client.newCall(request);
        try {
            Response response = call.execute();
            boolean success = response.isSuccessful();
            if (success) {
                ResponseBody body = response.body();
                return body.toString();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

}
